package com.lykj.llw.box.adapter

import android.widget.ImageView
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.lykj.lib_base.component.GlideApp
import com.lykj.llw.box.R
import com.lykj.llw.box.data.bean.response.HotGameLookMoreResponse

/**
 * ================================================
 * 热门游戏查看更多
 * ================================================
 *
 * @author gosha
 * @date 2023/12/11-10:29
 */
class HotGameLookMoreAdapter :
    BaseQuickAdapter<HotGameLookMoreResponse.DataDTO.RowsDTO, BaseViewHolder>(R.layout.item_reuse_home_game) {
    override fun convert(holder: BaseViewHolder, item: HotGameLookMoreResponse.DataDTO.RowsDTO) {
        holder.setText(R.id.tv_game_name, "${item.gamename}")
        holder.setText(R.id.tv_label, "${item.collection} ${item.gametype} ${item.gameSize}")
        holder.setText(R.id.tv_summery, "${item.subject}")

        GlideApp.with(context)
            .load(item.icon)
            .transition(DrawableTransitionOptions.withCrossFade())
            .into(holder.getView(R.id.iv_icon))


        if (item.payRatio == 0.01) {
            holder.getView<ImageView>(R.id.iv_discount_count).setImageResource(R.mipmap.ic_discount_other)
        } else {
            holder.getView<ImageView>(R.id.iv_discount_count).setImageResource(R.mipmap.ic_discount_normal)
        }
    }
}